using System;
using System.Collections.Generic;
using System.Text;
using Xyne.Templates.BattleEffects;
using GarageGames.Torque.Core;

namespace Xyne.Utilities
{
    public class BattleEffectManager
    {
        #region members
        private static BattleEffectManager _instance;
        private List<BattleEffect> _battleEffects;
        #endregion

        #region Properties
        public static BattleEffectManager Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new BattleEffectManager();
                }

                return _instance;
            }
        }

        public List<BattleEffect> BattleEffects
        {
            get { return _battleEffects; }
        }
        #endregion

        #region Constructor
        public BattleEffectManager()
        {
            _battleEffects = new List<BattleEffect>();
        }
        #endregion

        #region Methods
        public void Init()
        {
            _battleEffects = new List<BattleEffect>();
        }

        #region Adding/Removing
        public void AddBattleEffect(BattleEffect battleEffect)
        {
            _battleEffects.Add(battleEffect);
            battleEffect.BattleEffectID = Guid.NewGuid();
            TorqueObjectDatabase.Instance.Register(battleEffect);
            battleEffect.StartEffect();
        }

        public void RemoveBattleEffect(BattleEffect battleEffect)
        {
            _battleEffects.Remove(battleEffect);
            
           // TorqueObjectDatabase.Instance.Unregister(battleEffect);
        }
        #endregion
        #endregion
    }
}
